export default {
  clearChooseRadio(call) {
    console.log(this.custormItemData, 'this.custormItemData')
    this.custormItemData.params.link = ''
    // 兼容style
    if (!this.custormItemData.style) {
      this.custormItemData.style = { display: '1', title: '' }
    } else {
      this.custormItemData.style.title = ''
    }
    this.custormItemData.data = []

    if (
      Object.prototype.toString.call(call) === '[object Function]'
    ) {
      call(this.custormItemData)
    }

    this.$forceUpdate()
  },
  filterDisplayData(arr, key, call) {
    if (Array.isArray(arr) && arr.length > 0) {
      const result = [...this.custormItemData.data]
      arr.map(item => {
        const newIndex = this.custormItemData.data.findIndex((displayItem) => {
          return `${displayItem[key]}` === `${item[key]}`
        })
        if (newIndex === -1) {
          if (
            Object.prototype.toString.call(call) === '[object Function]'
          ) {
            call(item, result)
          }
        }
      })
      this.$set(this.custormItemData, 'data', result)
    }
  }
}
